package com.netnovelstore.service;

import com.netnovelstore.pojo.Exception.NotDataException;
import com.netnovelstore.pojo.Result;
import com.netnovelstore.pojo.User;
import com.netnovelstore.viewObject.LoginResult;
import com.netnovelstore.viewObject.UserListResult;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;

public interface UserService {
    /**
     * @return com.netnovelstore.pojo.Result
     * @Author maotao
     * @Description 验证用户登录
     * @Date 10:24 2022/9/2
     * @Param [username, password]
     **/
    default Result<LoginResult> Login(String username, String password) throws NotDataException {
        return null;
    }

    /**
     * @return com.netnovelstore.pojo.Result
     * @Author maotao
     * @Description 上传头像并替换头像
     * @Date 14:36 2022/10/3
     * @Param [file, oldUserImg, username]
     **/
    default Result<String> uploadProfile(MultipartFile file, String oldUserImg, String username) throws IOException {
        return null;
    }

    /**
     * @return com.netnovelstore.pojo.Result
     * @Author maotao
     * @Description 上传头像
     * @Date 14:36 2022/10/3
     * @Param [file]
     **/
    default Result<String> addProfile(MultipartFile file) throws IOException {
        return null;
    }

    /**
     * @return com.netnovelstore.pojo.Result
     * @Author maotao
     * @Description 用户注册
     * @Date 14:36 2022/10/3
     * @Param [user]
     **/

    default Result userRegistered(User user) throws SQLException {
        return null;
    }

    /**
     * @return com.netnovelstore.pojo.Result
     * @Author maotao
     * @Description 按需更新用户所有信息
     * @Date 14:36 2022/10/3
     * @Param [user]
     **/

    default Result updateUserByNumber(User user) throws NotDataException, SQLException {
        return null;
    }

    /**
     * @return com.netnovelstore.pojo.Result
     * @Author maotao
     * @Description 批量删除指定用户
     * @Date 14:37 2022/10/3
     * @Param [number]
     **/
    Result delUserByNumberList(List<Integer> numberList) throws Exception;

    /**
     * @return com.netnovelstore.pojo.Result
     * @Author maotao
     * @Description 分页获取用户列表
     * @Date 14:37 2022/10/3
     * @Param [currentPage, pageSize]
     **/
    Result<UserListResult> getUserList(Integer currentPage, Integer pageSize) throws Exception;

    /**
     * @return com.netnovelstore.pojo.Result
     * @Author maotao
     * @Description 按照 关键字 搜索所有用户
     * @Date 14:37 2022/10/3
     * @Param [keyword]
     **/
    Result<List<User>> searchUserByInfo(String keyword) throws Exception;

    /**
     * @return com.netnovelstore.pojo.Result
     * @Author maotao
     * @Description 判断用户是否存在
     * @Date 17:13 2022/11/18
     * @Param [userName]
     **/
    Result<Boolean> isExistByUserName(String userName);

    Result<Boolean> updateNickName(HttpServletRequest request, HttpServletResponse response, Integer userNumber, String nickName) throws Exception;


}
